class draw {
	constructor(info) {
		this.info = info;
	}

	 async drawImage(call) {
		let _this = this.info;
		_this.$nextTick(async () => {
			// 初始化
			await _this.$refs.rCanvas.init({
				canvas_id: "rCanvas"
			})
			_this.$refs.rCanvas.show = true
			// 画图
			await _this.$refs.rCanvas.drawImage({
				url: '/static/bg.png',
				x: 0,
				y: 0,
				w: 375 * 0.8,
				h: 500
			}).catch(err_msg => {
				uni.showToast({
					title: err_msg,
					icon: "none"
				})
			})
	
			await _this.$refs.rCanvas.drawImage({
				url: _this.qr,
				x: 90,
				y: 155,
				w: 120,
				h: 130,
				
			}).catch(err_msg => {
				uni.showToast({
					title: err_msg,
					icon: "none"
				})
			})
			
			
			// 画标题
			await this.$refs.rCanvas.drawText({
				text:  "扫一扫，快速申请加入",		
				x:65,
				y: 280,
				font_color: "#909399",
				font_size: 34,
				font_weight: "bolder",
				
			}).catch(err_msg => {
				uni.showToast({
					title: err_msg,
					icon: "none"
				})
			})
			



			// 生成海报
			await _this.$refs.rCanvas.draw((res) => {
				call(res.tempFilePath)
			})
			
		})

	}






}


export default draw;
